home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / gdm3 / Init / Default
Encoding:
Text File  |  2011-09-21  |  2.0 KB  |  79 lines

  1. #!/bin/sh
  2. # Stolen from the debian kdm setup, aren't I sneaky
  3. # Plus a lot of fun stuff added
  4. #  -George
  5.  
  6. PATH="/usr/bin:$PATH"
  7. OLD_IFS=$IFS
  8.  
  9. gdmwhich () {
  10.   COMMAND="$1"
  11.   OUTPUT=
  12.   IFS=:
  13.   for dir in $PATH
  14.   do
  15.     if test -x "$dir/$COMMAND" ; then
  16.       if test "x$OUTPUT" = "x" ; then
  17.         OUTPUT="$dir/$COMMAND"
  18.       fi
  19.     fi
  20.   done
  21.   IFS=$OLD_IFS
  22.   echo "$OUTPUT"
  23. }
  24.  
  25. sysresources=/etc/X11/Xresources
  26.  
  27. # merge in defaults
  28. if [ -f "$sysresources" ]; then
  29.     xrdb -merge "$sysresources"
  30. fi
  31.  
  32. sysmodmap=/etc/X11/Xmodmap
  33.  
  34. XMODMAP=`gdmwhich xmodmap`
  35. if [ "x$XMODMAP" != "x" ] ; then
  36.   if [ "x$GDM_PARENT_DISPLAY" = "x" ]; then
  37.     if [ -f $sysmodmap ]; then
  38.       $XMODMAP $sysmodmap
  39.     fi
  40.   else
  41.     ( DISPLAY=$GDM_PARENT_DISPLAY XAUTHORITY=$GDM_PARENT_XAUTHORITY $XMODMAP -pke ) | $XMODMAP -
  42.   fi
  43.  
  44.   #
  45.   # Switch Sun's Alt and Meta mod mappings
  46.   #
  47.  
  48.   UNAME=`gdmwhich uname`
  49.   PROCESSOR=`$UNAME -p`
  50.   if [ "x$PROCESSOR" = "xsparc" ]; then
  51.     if $XMODMAP | grep mod4 | grep Alt > /dev/null 2>/dev/null
  52.     then
  53.       $XMODMAP -e "clear Mod1" \
  54.                -e "clear Mod4" \
  55.                -e "add Mod1 = Alt_L" \
  56.                -e "add Mod1 = Alt_R" \
  57.                -e "add Mod4 = Meta_L" \
  58.                -e "add Mod4 = Meta_R"
  59.     fi
  60.   fi
  61. fi
  62.  
  63. SETXKBMAP=`gdmwhich setxkbmap`
  64. if [ "x$SETXKBMAP" != "x" ] ; then
  65.   # FIXME: is this all right?  Is this completely on crack?
  66.   # What this does is move the xkb configuration from the GDM_PARENT_DISPLAY
  67.   # FIXME: This should be done in code.  Or there must be an easier way ...
  68.   if [ -n "$GDM_PARENT_DISPLAY" ]; then
  69.     # Hurray for awk
  70.     XKBARGS=$( (DISPLAY=$GDM_PARENT_DISPLAY XAUTHORITY=$GDM_PARENT_XAUTHORITY $SETXKBMAP -v -v) | awk '/^model:/ { printf "-model %s ", $2 } /^layout:/ { printf "-layout %s ", $2 } /^variant:/ { printf "-variant %s ", $2 } /^options:/ { printf "-option %s ", $2}' )
  71.     XKBSETUP=`( DISPLAY=$GDM_PARENT_DISPLAY XAUTHORITY=$GDM_PARENT_XAUTHORITY $SETXKBMAP -v )`
  72.     if [ -n "$XKBARGS" ]; then
  73.       $SETXKBMAP $XKBARGS
  74.     fi
  75.   fi
  76. fi
  77.  
  78. exit 0
  79.